package cn.kgc.tangcco.array;

import org.junit.Test;

/**
 * @author 李昊哲
 * @Description
 * @date 2020/8/14 上午10:42
 */
public class Demo03 {
    @Test
    public void test01() {
        int[] arr = {0, 1, 2, 3, 4};
        for (int i = 0; i < 5; i++) {
            System.out.println(arr[i]);
        }
    }
    @Test
    public void test02() {
        int[] arr = {0, 1, 2, 3, 4};
        // 获取该数组的长度
        System.out.println(arr.length);
    }

    @Test
    public void test03() {
        int[] arr = {0, 1, 2, 3, 4};
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }

    @Test
    public void test04() {
        int[] arr = new int[5];
        for (int i = 0; i < arr.length; i++) {
            // 循环存储
            arr[i] = i;
        }

        for (int i = 0; i < arr.length; i++) {
            // 遍历
            System.out.println(arr[i]);
        }
    }

}
